/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 东莞呵呵
 * Date:2022-04-23
 * Time:10:05
 */
public class TestStudent {
    public static void main(String[] args) {
        boolean flg=false;
        int index=0;
        int ageMax=0;
        Student arr[]=new Student[3];
        arr[0]=new Student(111,"Mike","boy",18);
        arr[1]=new Student(112,"Tony","boy",19);
        arr[2]=new Student(113,"mony","boy",20);
        for (int i = 0; i < 3; i++) {
            if(arr[i].getName().equals("lily")) {
                flg = true;
            }
        }
        if(flg==false){
            arr[2]=new Student(1005,"lily","famale",20);
        }
        for (int i = 0; i < 3; i++) {
            if(arr[i].getAge()>ageMax){
                ageMax=arr[i].getAge();
                index=i;
            }
        }
        System.out.println(arr[index]);
    }
}
